<?php

namespace Wilead\IArtistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Table(
 *      indexes={
 *          @ORM\Index(name="user_id", columns={"uid", "fid"})
 *      }
 * )
 * @ORM\Entity(repositoryClass="Wilead\IArtistBundle\Repository\ChatRepository")
 */
class Chat {

    const TYPE_TEXT = 'text';
    const TYPE_VIDEO = 'voice';

    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=10)
     */
    private $type;

    /**
     * @ORM\Column(type="text") 
     */
    private $content;

    /**
     * @ORM\Column(type="integer")
     */
    private $uid;

    /**
     * @ORM\Column(type="integer")
     */
    private $fid;

    /**
     * @ORM\Column(type="boolean")
     */
    private $readed;

    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $extension;

    /**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(type="datetime")
     */
    private $created;

    public function __construct() {
        $this->type = self::TYPE_TEXT;
        $this->readed = FALSE;
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set type
     *
     * @param string $type
     * @return Chat
     */
    public function setType($type) {
        $this->type = $type;

        return $this;
    }

    /**
     * Get type
     *
     * @return string 
     */
    public function getType() {
        return $this->type;
    }

    /**
     * Set content
     *
     * @param string $content
     * @return Chat
     */
    public function setContent($content) {
        $this->content = $content;

        return $this;
    }

    /**
     * Get content
     *
     * @return string 
     */
    public function getContent() {
        return $this->content;
    }

    /**
     * Set uid
     *
     * @param integer $uid
     * @return Chat
     */
    public function setUid($uid) {
        $this->uid = $uid;

        return $this;
    }

    /**
     * Get uid
     *
     * @return integer 
     */
    public function getUid() {
        return $this->uid;
    }

    /**
     * Set fid
     *
     * @param integer $fid
     * @return Chat
     */
    public function setFid($fid) {
        $this->fid = $fid;

        return $this;
    }

    /**
     * Get fid
     *
     * @return integer 
     */
    public function getFid() {
        return $this->fid;
    }

    /**
     * Set created
     *
     * @param \DateTime $created
     * @return Chat
     */
    public function setCreated($created) {
        $this->created = $created;

        return $this;
    }

    /**
     * Get created
     *
     * @return \DateTime 
     */
    public function getCreated() {
        return $this->created;
    }

    public function getExtension() {
        return $this->extension;
    }

    public function setExtension($extension) {
        $this->extension = $extension;
    }


    /**
     * Set readed
     *
     * @param boolean $readed
     * @return Chat
     */
    public function setReaded($readed)
    {
        $this->readed = $readed;
    
        return $this;
    }

    /**
     * Get readed
     *
     * @return boolean 
     */
    public function getReaded()
    {
        return $this->readed;
    }
}